<?php 
require_once 'lib/controllerWithoutGetOrPost.php';
require_once '../db/PersonDB.php';
require_once '../models/PersonModel.php';
require_once '../views/PersonView.php';
require_once '../models/EmailModel.php';
require_once 'db/NoticeSummaryDB.php';
require_once 'views/NoticeSummaryView.php';
require_once 'models/NoticeSummaryModel.php';

$email = new EmailModel();
$transId = 0;
if (!empty($_GET['transId'])) {
    $transId = intval($_GET['transId']);
}
if (!empty($_POST['transId'])) {
    $transId = $_POST['transId'];
}
$performUpdate = FALSE;
if (!empty($_POST['update'])) {
    $performUpdate = TRUE;
}
$sendEmail = FALSE;
if (!empty($_POST['email'])) {
    $sendEmail = TRUE;
}
if ($performUpdate || $sendEmail) {
    modelUpdateDatabase($transId, $_POST);
}
if (!empty($transId)) {
    $transInfo = getTransInfo($transId);
    $text = modelSummary($transInfo, $sendEmail);
    echo viewPage($text);
}
?>
